/**
 */
package fUML.Semantics.Actions.CompleteActions;

import fUML.Semantics.Actions.BasicActions.ActionActivation;

import fUML.Semantics.CommonBehaviors.Communications.SignalInstance;

/**
 * <!-- begin-user-doc -->
 * A representation of the model object '<em><b>Accept Event Action Activation</b></em>'.
 * <!-- end-user-doc -->
 *
 * <!-- begin-model-doc -->
 * An accept event action activation is an action activation for an accept event
 *                 action.
 * <!-- end-model-doc -->
 *
 * <p>
 * The following features are supported:
 * <ul>
 *   <li>{@link fUML.Semantics.Actions.CompleteActions.AcceptEventActionActivation#getEventAccepter <em>Event Accepter</em>}</li>
 *   <li>{@link fUML.Semantics.Actions.CompleteActions.AcceptEventActionActivation#isWaiting <em>Waiting</em>}</li>
 * </ul>
 * </p>
 *
 * @see fUML.Semantics.Actions.CompleteActions.CompleteActionsPackage#getAcceptEventActionActivation()
 * @model
 * @generated
 */
public interface AcceptEventActionActivation extends ActionActivation {
	/**
	 * Returns the value of the '<em><b>Event Accepter</b></em>' reference.
	 * It is bidirectional and its opposite is '{@link fUML.Semantics.Actions.CompleteActions.AcceptEventActionEventAccepter#getActionActivation <em>Action Activation</em>}'.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * If the accept event action activation is waiting for an event, then this is
	 *                   the accepter it has registered for the event.
	 * <!-- end-model-doc -->
	 * @return the value of the '<em>Event Accepter</em>' reference.
	 * @see #setEventAccepter(AcceptEventActionEventAccepter)
	 * @see fUML.Semantics.Actions.CompleteActions.CompleteActionsPackage#getAcceptEventActionActivation_EventAccepter()
	 * @see fUML.Semantics.Actions.CompleteActions.AcceptEventActionEventAccepter#getActionActivation
	 * @model opposite="actionActivation" ordered="false"
	 * @generated
	 */
	AcceptEventActionEventAccepter getEventAccepter();

	/**
	 * Sets the value of the '{@link fUML.Semantics.Actions.CompleteActions.AcceptEventActionActivation#getEventAccepter <em>Event Accepter</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @param value the new value of the '<em>Event Accepter</em>' reference.
	 * @see #getEventAccepter()
	 * @generated
	 */
	void setEventAccepter(AcceptEventActionEventAccepter value);

	/**
	 * Returns the value of the '<em><b>Waiting</b></em>' attribute.
	 * <!-- begin-user-doc -->
	 * <p>
	 * If the meaning of the '<em>Waiting</em>' attribute isn't clear,
	 * there really should be more of a description here...
	 * </p>
	 * <!-- end-user-doc -->
	 * @return the value of the '<em>Waiting</em>' attribute.
	 * @see #setWaiting(boolean)
	 * @see fUML.Semantics.Actions.CompleteActions.CompleteActionsPackage#getAcceptEventActionActivation_Waiting()
	 * @model required="true" ordered="false"
	 * @generated
	 */
	boolean isWaiting();

	/**
	 * Sets the value of the '{@link fUML.Semantics.Actions.CompleteActions.AcceptEventActionActivation#isWaiting <em>Waiting</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @param value the new value of the '<em>Waiting</em>' attribute.
	 * @see #isWaiting()
	 * @generated
	 */
	void setWaiting(boolean value);

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * // Accept a signal occurance for the given signal instance.
	 *  // If the
	 *                   action does not unmarshall, then place the signal instance on the result pin, if
	 *                   any.
	 *  // If the action does unmarshall, then get the feature values of the
	 *                   signal instance, and place the values for each feature on the corresponding output
	 *                   pin.
	 *  // Concurrently fire all output pins while offering a single control
	 *                   token.
	 *  // If there are no incoming edges, then re-register this accept
	 *                   event action execution with the context object.
	 *  
	 *                   AcceptEventAction action = (AcceptEventAction)(this.node);
	 *  OutputPinList
	 *                   resultPins = action.result;
	 *  
	 *  Debug.println("[accept] action = "
	 *                   + action.name + ", signalinstance = " + signalInstance);
	 *  
	 *  if
	 *                   (this.running) {
	 *  if (!action.isUnmarshall) {
	 *  ValueList result =
	 *                   new ValueList();
	 *  result.addValue(signalInstance);
	 *  if
	 *                   (resultPins.size() > 0) {
	 *  this.putTokens(resultPins.getValue(0),
	 *                   result);
	 *  }
	 *  } else {
	 *  FeatureValueList featureValues =
	 *                   signalInstance.getFeatureValues();
	 *  for (int i = 0; i <
	 *                   featureValues.size(); i++) {
	 *  FeatureValue featureValue =
	 *                   featureValues.getValue(i);
	 *  OutputPin resultPin =
	 *                   resultPins.getValue(i);
	 *  this.putTokens(resultPin,
	 *                   featureValue.values);
	 *  }
	 *  }
	 *  
	 *                   this.sendOffers();
	 *  
	 *  this.waiting = false;
	 *  
	 *                   Debug.println("[fire] Checking if " + this.node.name + " should fire
	 *                   again...");
	 *  // if (this.isReady()) {
	 *  // this.fire();
	 *  //
	 *                   }
	 *  this.receiveOffer();
	 *  }
	 *  
	 *  
	 * <!-- end-model-doc -->
	 * @model signalInstanceRequired="true" signalInstanceOrdered="false"
	 * @generated
	 */
	void accept(SignalInstance signalInstance);

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * // Return true if the given signal instance matches a trigger of the accept
	 *                   action of this activation.
	 *  
	 *  AcceptEventAction action =
	 *                   (AcceptEventAction)(this.node);
	 *  TriggerList triggers =
	 *                   action.trigger;
	 *  Signal signal = signalInstance.type;
	 *  
	 *                   boolean matches = false;
	 *  int i = 1;
	 *  while (!matches & i
	 *                   <= triggers.size()) {
	 *  matches =
	 *                   ((SignalEvent)(triggers.getValue(i-1).event)).signal == signal;
	 *  i = i +
	 *                   1;
	 *  }
	 *  
	 *  return matches;
	 * <!-- end-model-doc -->
	 * @model required="true" ordered="false" signalInstanceRequired="true" signalInstanceOrdered="false"
	 * @generated
	 */
	boolean match(SignalInstance signalInstance);

} // AcceptEventActionActivation
